let { z } = require('zod')

const optionalSchema = z.object({
  name: z.string(),
  age: z.number().optional(), // 可选 
});

const defaultSchema = z.object({
  name: z.string(),
  age: z.number().default(18), // 默认值
});

console.log(optionalSchema.parse({ name: "Alice" })); // { name: "Alice" }
console.log(defaultSchema.parse({ name: "Alice" })); // { name: 'Alice', age: 18 }
